- unless @galleries.empty?
  %h2
    = "Found #{pluralize(@galleries.length, 'gallery')} matching the term"
    %span.search_term= "\"#{params[:term]}\""
  %div.gallery_results
    - @galleries.each do |gallery|
      - if gallery.private?
        - if logged_in? && current_user.authorized_to_view?(gallery)
          %table.index_gallery{:border => 0}
            %tr
              %td.gallery_preview
                %a{:href => gallery_url(gallery), :title => gallery.text_description}
                  %img.photo_thumb{:src => gallery.thumbnail, :title => gallery.text_description}
            %tr
              %td.gallery_name= gallery.name
      - else
        %table.index_gallery{:border => 0}
          %tr
            %td.gallery_preview
              %a{:href => gallery_url(gallery), :title => gallery.text_description}
                %img.photo_thumb{:src => gallery.thumbnail, :title => gallery.text_description}
          %tr
            %td.gallery_name= gallery.name